﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UIWindow.Enums;
using UIWindow.Lucifer;

namespace UIWindow.Models
{
    public class DeviceModel : INotifyPropertyChanged, IComparable<DeviceModel>
    {
        public ICommunication Comm { get; set; }
        public byte DA1 { get; set; }
        /// <summary>
        /// 索引
        /// </summary>
        public int Index { get; set; }
        /// <summary>
        /// IP地址或串口号
        /// </summary>
        public string IPofCom { get; set; }
        /// <summary>
        /// 端口
        /// </summary>
        public int Port { get; set; }
        /// <summary>
        /// 波特率
        /// </summary>
        public int BaudRate { get; set; }
        /// <summary>
        /// 是否是网络通信
        /// </summary>
        public bool IsSocket { get; set; }
        /// <summary>
        /// 设备类型
        /// </summary>
        public DeviceType Types { get; set; }

        public event PropertyChangedEventHandler PropertyChanged;
        public int CompareTo(DeviceModel p)
        {
            int result = 0;
            if (Index == p.Index) result = 0;
            if (Index > p.Index) result = 1;
            if (Index < p.Index) result = -1;
            return result;
        }
    }
}
